﻿//1576.替换所有的问号
class Solution 
{
public:
    string modifyString(string s) 
    {
        int n = s.size();
        for (int i = 0; i < n; i++)
        {
            if (s[i] == '?')
            {
                char ch = 'a';
                while (s[i] == '?')
                {
                    if ((i == 0 || ch != s[i - 1]) && (i == n - 1 || ch != s[i + 1]))
                    {
                        s[i] = ch;
                    }
                    else
                    {
                        ch++;
                    }
                }

            }
        }
        return s;
    }
};

//198.打家劫舍
class Solution 
{
public:
    int rob(vector<int>& nums)
    {
        int n = nums.size();
        vector<int> f(n), g(n);
        f[0] = nums[0];

        for (int i = 1; i < n; i++)
        {
            f[i] = g[i - 1] + nums[i];
            g[i] = max(g[i - 1], f[i - 1]);
        }

        return max(f[n - 1], g[n - 1]);
    }
};